import path from 'path'
import {createSvgIconsPlugin} from "vite-plugin-svg-icons";

export default function createSvgIcon(isBuild: Boolean) {
    return createSvgIconsPlugin({
        // 指定需要缓存的图标文件夹
        iconDirs: [
            // 这里可以配置多个图标文件夹
            path.resolve(process.cwd(), "src/assets/icons/svg"),
            path.resolve(process.cwd(), "src/assets/icons/sidebarSvg"),
        ],
        // 指定symbolId格式
        symbolId: 'icon-[dir]-[name]',
        svgoOptions: isBuild,
    })
}
